<template>
	<view class="pd pt20">
		
	
	<view class="bgff pd pt20 pm20 dsfxczxfsdf box">
	<view class="pt10 pm10 display-flex fz30 z6">
		<view class="xczvrytxctrtr  vertical-center tl">
			姓名:
		</view>
		<view class="z3 flex-1">
			<input v-model="ret.urgencyName" type="text" class="kxcxzrtrtxr pl20" placeholder="请输入紧急联系人姓名" />
		</view>
	</view>
	<view class="pt10 pm10 display-flex fz30 z6">
		<view class="xczvrytxctrtr  vertical-center tl">
			电话:
		</view>
		<view class="z3 flex-1">
			<input v-model="ret.urgencyPhone" type="number" class="kxcxzrtrtxr pl20" placeholder="请输入紧急联系人电话" />
		</view>
	</view>
	<view class="pt10 pm10 display-flex fz30 z6">
		<view class="xczvrytxctrtr  vertical-center tl">
			与其关系:
		</view>
		<view class="z3 flex-1">
			<radio-group @change="radioChange" class="">
				<label class="xzczxctrt mr20" v-for="(item, index) in items" :key="item.dictValue">
					<view class="display-flex">
						<view>
							<radio 
							:value="item.dictValue" 
							class="kcxzvxcdrytr" 
							:checked="ret.urgencyRelation === item.dictValue" />
						</view>
						<view class="fz28 fgfdgdfgbty">{{item.dictLabel}}</view>
					</view>
				</label>
	
			</radio-group>
	
	
		</view>
	</view>
	</view>
	<view class="mt100">
		<button type="primary" @tap="bjhxdfrtx">提交</button>
	</view>
</view>
</template>
<script lang="ts" setup>
	import { ref } from "vue"
	import { upImg, hf, yzphone ,callBack,dxrequest,zidianall} from "@/util/index.js"
		import {onLoad} from "@dcloudio/uni-app"
	const current = ref(1)
	const jdfdsrt = ref([])
	const ret = ref({})
	const items = ref([])
	const radioChange = (data) => {
		ret.value.urgencyRelation = data.detail.value
	}
	const getuser = async () => {
		const openid = uni.getStorageSync("openid")
		const { data } = await dxrequest("/api/user/" + openid)
		ret.value = data
	
	}
	onLoad(async()=>{
		const relationshipWith = await zidianall("relationship_with")
		items.value = relationshipWith
	})
	getuser()
	const bjhxdfrtx = async()=>{
		const ksjd = await dxrequest("/api/user",ret.value,"put")
		if(ksjd.code==0){
			uni.showToast({
				title:"保存成功!"
			})
			setTimeout(a=>{
				callBack()
			},2000)
		}
	}
</script>

<style scoped>
	.dsfxczxfsdf{
		border-radius: 8rpx;
	}
</style>